/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package data.logic;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;

import java.util.Vector;

/**
 *
 * @author groep 11
 * @date 2007-2008
 * 
 */
public class WorldLogic {
    //Fields
    private Dimension dimension;
    private Square[][] squares = null;
    private Vector<String> friends;

    public WorldLogic() {
        //Number of Villages width x height
        dimension = new Dimension(42, 42);
        init();
    }

    /**
     *  Every square in the world will be made with squareType "gras"
     *  to initialize the world. 
     */
    public void init() {
        squares = new Square[(int) getDimension().getWidth()][(int) getDimension().getHeight()];
        SquareType grasSquare = new SquareType("Gras",true,new Color(95,195,89));

        for (int j = 0; j < getDimension().getHeight(); j++) {
            for (int i = 0; i < getDimension().getWidth(); i++) {
                squares[i][j] = new Square(grasSquare, new Point(i, j));
            }
        }
    }
    public void drawVillages(Vector<Square> villages) {

        for (Square v : villages) {
            squares[v.getPosition().x][v.getPosition().y] = v;
        }
    }

    public void drawRiver(Vector<Square> river) {

        SquareType riverSquare = new SquareType("Water", false, Color.BLUE);
        for (Square v : river) {
            v.setSquareType(riverSquare);
            squares[v.getPosition().x][v.getPosition().y] = v;
        }
    }
      public void drawForest(Vector<Square> river) {

        SquareType riverSquare = new SquareType("Forest", false,new Color(33,99,00));
        for (Square v : river) {
            v.setSquareType(riverSquare);
            squares[v.getPosition().x][v.getPosition().y] = v;
        }
    }

    // Getters en Setters
    public Dimension getDimension() {
        return dimension;
    }

    public void setDimension(Dimension dimension) {
        this.dimension = dimension;
    }

    public Square[][] getSquares() {
        return squares;
    }
}
